{% extends "base.html" %}
{% load mnav %}
{% load thumbnail %}

{% block title %}{{ movie.title }}{% endblock %}

{% block content %}
<div class="container">
<div class="span-6">
    <div class="box">
        <a href="{{ MEDIA_URL }}{{ movie.poster_filename}}"><img src="{% thumbnail movie.poster_filename 170x250 %}"></a>
    </div>
</div>
<div class="span-14 last">
    <h2>{{ movie.title }} ({{ movie.year }}) ({{ movie.imdb_kind }})<a href="{{ movie.imdb_link }}"><img src="{{ MEDIA_URL }}img/movies/logo/imdb_icon.gif"></a></h2>
    <b>Genre:</b>
    {% for genre in movie.genres.all %}
    <a href="{% url movies.views.genre_detail genre_id=genre.id %}"> {{ genre.name }}</a>
    {% if not forloop.last %} |{% endif %}
    {% endfor %}
    <br>
    <b>Studio:</b>
    {% for company in movie.production_companies.all %}
    <a href="{% url movies.views.company_detail company_id=company.id %}"> {{ company.name }}</a>
    {% if not forloop.last %} |{% endif %}
    {% endfor %}
    <br>
    <b>Country:</b>
    {% for country in movie.countries.all %}
    <a href="{% url movies.views.country_detail country_id=country.id %}"> {{ country.name }}</a>
    {% if not forloop.last %} |{% endif %}
    {% endfor %}
    <br>
    <b>Overview:</b> {{ movie.plot_outline }}
    <br>
    <b>Directors:</b> 
        {% for member in directors %}
        <a href="{% url movies.views.person_detail person_id=member.person.id %}">{{ member.person.name }}</a>
        {% if not forloop.last %} |{% endif %}
        {% endfor %}
    <br>
    <b>Writers:</b> 
        {% for member in writers %}
        <a href="{% url movies.views.person_detail person_id=member.person.id %}">{{ member.person.name }}</a>
        {% if not forloop.last %} |{% endif %}
        {% endfor %}
    <br>
    <b>Actors:</b>
    <table>
        {% for member in actors %}
        <tr>
            <td> <a href="{% url movies.views.person_detail person_id=member.person.id %}">{{ member.person.name }}</a></td>
            <td>{{ member.role }}</td>
        </tr>
        {% endfor %}
    </table>
    <b>Versions:</b>
    <table> 
        {% for directory in movie.videodirectory_set.all %}
        <tr><td colspan=8>{{ directory.format_name }}</td></tr>
            {% for file in directory.movievideofile_set.all %}
            <tr>
                <td>[{{ forloop.counter }}]</td>
                <td>{{ file.file_size|bytes_to_string }}</td>
                <td>{{ file.general_duration|msecs_to_string }}</td>
                <td>{{ file.general_format }}</td>
                <td>{{ file.video_format }}</td>
                <td>{{ file.video_width }}x{{ file.video_height }}</td>
                <td>{{ file.audio_format }}</td>
                <td>{{ file.audio_channels }}</td>
            </tr>
            {% endfor %}
        {% endfor %}
    </table>
</div>
</div>
<a href="{{ MEDIA_URL }}{{ movie.backdrop_filename }}"><img src="{% thumbnail movie.backdrop_filename 480x270 %}"></a>
{% endblock %}
